package cn.yuanqiao.quartz.task;

import cn.yuanqiao.archive.guidang.service.GuidangService;
import cn.yuanqiao.common.utils.DateUtils;
import cn.yuanqiao.quartz.util.MethodDescription;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component("guiDangTask")
public class GuiDangTask {
    private static final Logger logger = LoggerFactory.getLogger(GuiDangTask.class);

    @Autowired
    private GuidangService yqdaDocumentService;

    @MethodDescription("租户自动归档定时任务，arg0需要传入tenantCode")
    public void guiDangTask(String tenantCode)
    {
        Date start = new Date();
        logger.info("租户："+tenantCode+"，定时归档任务开始="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,start));
        yqdaDocumentService.guiDangTimer(tenantCode);
        Date end = new Date();
        logger.info("租户："+tenantCode+"，定时归档任务结束="+ DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,end));
        logger.info("耗时="+(end.getTime()-start.getTime())+"毫秒");
    }
}
